from itertools import pairwise  # 生成相邻元素对


class Solution:
    def countCompleteDayPairs(self, hours: list[int]) -> int:
        # length = len(hours) - 1
        # n = 0
        # for i in range(length):
        #     for j in range(i + 1, length + 1):
        #         ans = hours[i] + hours[j]
        #         if ans >= 24 and ans % 24 == 0:
        #             n += 1
        # return n

        ans = 0
        for i in range(1, len(hours)):
            for j in range(i):
                if (hours[i] + hours[j]) % 24 == 0:
                    ans += 1
        return ans


hours = [12, 12, 30, 24, 24]
aa = Solution()
bb = aa.countCompleteDayPairs(hours)
print(bb)
